package com.itboye.jmsfhz.app.ui.me.personsettings;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.itboye.app.mian.activity.AboutActivity;
import com.itboye.app.mian.activity.ActivityGeRenData;
import com.itboye.core.object.BaseActivity;
import com.itboye.core.object.SpPublicParams;
import com.itboye.core.utils.SPUtils;
import com.itboye.jmsfhz.R;
import com.itboye.jmsfhz.app.MainApplication;
import com.itboye.jmsfhz.app.logincontroller.ILoginState;
import com.itboye.jmsfhz.app.logincontroller.LoginController;
import com.itboye.jmsfhz.app.logincontroller.LoginedState;
import com.itboye.jmsfhz.app.logincontroller.UnLoginState;

@SuppressLint("ResourceAsColor")
public class SettingActivity extends BaseActivity implements OnClickListener {
	private ImageView imgBack;
	private RelativeLayout relayoutZiLiao, relayoutZhangHuAnQuan,
			relayoutMessage, relayoutCustomer, relayoutVIP, relayoutAbout,
			btn_exit;
	
	@Override
	public int initView() {
		// TODO Auto-generated method stub
		return R.layout.fragment_settings;
	}

	@Override
	public void onMyCreate() {
		// TODO Auto-generated method stub

	}

	@Override
	public void onClick(View view) {
		Intent intent;
		switch (view.getId()) {
		case R.id.imgBack:
			finish();
			break;
		case R.id.relayoutZiLiao:
			LoginController.queryMyMessae(this, null);
//			intent = new Intent(this, ActivityGeRenData.class);
//			startActivity(intent);
			break;
	
		case R.id.relayoutMessage:
			intent = new Intent(this, AboutActivity.class);
			startActivity(intent);
			break;
		case R.id.relayoutCustomer:
			intent = new Intent(this, AboutActivity.class);
			startActivity(intent);
			break;
		
		case R.id.relayoutAbout:
			intent = new Intent(this, AboutActivity.class);
			startActivity(intent);
			break;
		case R.id.btn_exit:
			SPUtils.put(this, null, SpPublicParams.IS_LOGINED, false);
			LoginController.setLoginState(new UnLoginState());
			exit();
			finish();
			break;
		default:
			break;
		}
	}

	private void exit() {
		// TODO Auto-generated method stub
		SPUtils.put(MainApplication.context, null, SpPublicParams.USER_NAME, "");
//		SPUtils.put(MainApplication.context, null, SpPublicParams.USERHEAD, "");
		SPUtils.put(MainApplication.context, null, SpPublicParams.NICK_NAME, "");
		SPUtils.put(MainApplication.context, null, SpPublicParams.UID, "");
		SPUtils.put(MainApplication.context, null, SpPublicParams.SEX, "");
		SPUtils.put(MainApplication.context, null, SpPublicParams.SIGNATURE, "");
		SPUtils.put(MainApplication.context, null, SpPublicParams.PHONE_MODEL, "");
	}
	
}
